package edu.njust.httpmanager.exception;

import edu.njust.httpmanager.constance.ResponseCode;
import lombok.Getter;

/**
 * 自定义异常
 */
@Getter
public class CustomException extends RuntimeException {

    public final int code;

    public CustomException(ResponseCode code, String message) {
        super(message);
        this.code = code.getCode();
    }

    public CustomException(ResponseCode errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }

    public CustomException(String message) {
        super(message);
        this.code = ResponseCode.SYSTEM_ERROR.getCode();
    }

}
